﻿@model BastInfos.Models.Article.ArticleListModel

@{
	ViewBag.Title = "Listes des Articles" + (Model.Category != null ? " : " + Model.Category.Description : String.Empty);
}

<div id="content">
	<h1><span>Liste des Articles @if (Model.Category != null) { <em>: @Model.Category.Description</em> }</span></h1>
	<br /><br />
	@foreach (var article in Model.Articles) {
		<div class="news_bloc">
			<div>
				<div class="f_left" style="width:325px;"><h3>@Html.RouteLink(article.Title, "Article", new { title = article.Title, id = article.id_Article })</h3></div>
				<div class="f_right">@String.Format("{0:g}", article.CreationDate)</div>
				<br class="clear" />
			</div>
			<hr style="height:1px;width:100%;border:0px;background:#CECECE;margin:3px 0px;" />
			<div class="p_justify" style="padding:5px;">@Html.Raw(article.Introduction)</div>
			<hr style="height:1px;width:100%;border:0px;background:#CECECE;margin:3px 0px;" />
			<div class="f_left">
    			@Html.RouteLink("Voir l'article", "Article", new { title = article.Title, id = article.id_Article })
    			/ <a href="@Url.RouteUrl("Article", new { title = article.Title, id = article.id_Article })#reactions">@article.ValidComments.Count() r&eacute;action(s)</a>
			</div>
			<div class="f_right">@Html.RouteLink(article.Category.Description, "ArticleCategory", new { title = article.Category.Description, id = article.Category.id_Category })</div>
			<br class="clear" />
		</div>
		<br />
	}
	<br />
	<div class="pager">
		<div class="prev">@if (Model.CurrentPage == 1) { <text>&nbsp;</text> } else {<a href="?page=@(Model.CurrentPage - 1)">Précédent</a> }</div>
		<div class="pages">
			Pages : 
			@for (int i = 1; i <= Model.PagesNumber; i++) {
				if(i == Model.CurrentPage) {
					<span>@i</span>
				} else {
					<a href="?page=@i">@i</a>
				}
			}
		</div>
		<div class="next">@if (Model.CurrentPage == Model.PagesNumber) { <text>&nbsp;</text> } else { <a href="?page=@(Model.CurrentPage + 1)">Suivant</a> }</div>
		<br class="clear" />
	</div>
	<br/>
	<a href="#haut">Retour en haut de la page</a>
</div>